<template>
  <div class="index">
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item>
        <img src="../assets/1.jpeg" alt="">
      </van-swipe-item>
      <van-swipe-item>
        <img src="../assets/2.jpeg" alt="">
      </van-swipe-item>
      <van-swipe-item>
        <img src="../assets/3.jpeg" alt="">
      </van-swipe-item>
    </van-swipe>
    <div class="nav">
      <ul>
        <li>
          <img src="../assets/11.png" alt="">
          <p>特色课</p>
        </li>
        <li>
          <img src="../assets/22.png" alt="">
          <p>一对一辅导</p>
        </li>
        <li>
          <img src="../assets/33.png" alt="">
          <p>学习日历</p>
        </li>
      </ul>
    </div>
    <div class="one">
      <p class="red">{{title1}}</p>
      <my-list v-for="(item,index) in teaList1" :key="index" :itemObj="item"></my-list>
    </div>
    <div class="two">
      <p class="red">{{title2}}</p>
      <nav-list v-for="(item,index) in teaList2" :key="index" :itemObj="item"></nav-list>
    </div>
    <div class="three">
      <p class="red">{{title3}}</p>
      <my-list v-for="(item,index) in teaList3" :key="index" :itemObj="item"></my-list>
    </div>
    <tabbar></tabbar>
  </div>
</template>

<script>
import tabbar from "@/components/tabbar.vue"
import myList from "@/components/myList.vue"
import navList from "@/components/navList.vue"
import { getBanner, getList } from "@/http/request"
export default {
  data() {
    return {
      teaList1: [],
      title1: '',
      title2: '',
      teaList2: [],
      title3: '',
      teaList3: []
    }
  },
  created() {
    //  getBanner().then(res=>{
    //   console.log(res);
    //  })
    getList().then(res => {
      console.log(res);
      this.title1 = res.data.data[0].channel_info.name
      this.teaList1 = res.data.data[0].list
      this.title2 = res.data.data[1].channel_info.name
      this.teaList2 = res.data.data[1].list
      this.title3 = res.data.data[2].channel_info.name
      this.teaList3 = res.data.data[2].list
    })
  },
  methods: {

  },
  components: {
    tabbar,
    myList,
    navList
  }
}
</script>
<style lang="scss" scoped>
.index {
  background-color: #f2f3f5;

  .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    height: 112px;
    line-height: 112px;
    text-align: center;
    background-color: #39a9ed;

    img {
      width: 100%;
      height: 100%;
    }
  }

  .nav {
    position: relative;
    top: -20px;
    left: 0;

    ul {
      display: flex;

      li {
        width: 103px;
        height: 103px;
        margin: 0 10px;
        background-color: #fff;
        border-radius: 6px;
        display: flex;
        flex-direction: column;
        align-items: center;

        img {
          width: 30px;
          height: 30px;
          margin-top: 20px;
        }

        p {
          font-size: 12px;
          margin-top: 10px;
        }
      }
    }
  }

  .one {
    margin: 0 10px;

    .red {
      font-size: 20px;
      border-left: 3px solid red;
      margin: 5px 0;
    }
  }

  .two {
    margin: 0 10px;
    .red {
      font-size: 20px;
      border-left: 3px solid red;
      margin: 5px 0;
    }
  }

  .three {
    margin: 0 10px;

    .red {
      font-size: 20px;
      border-left: 3px solid red;
      margin: 5px 0;
    }
  }
}
</style>

